<template>
	<view >
			<view class="list-cell u-border-bottom" v-for="(item, index) in list" :key="index" @click="carSeriesClick(item)">
				{{item.seriesName}}
			</view>
	</view>
</template>

<script>
	import API from "@/api/selectCar.js"
	import app from "../../App.vue"
	export default {
		name:"carSeries",
		onLoad(options){
			this.carBranId = JSON.parse(decodeURIComponent(options.item));
			console.log("车牌带过来的数据");
			console.log(this.carBranId);
			this.brandId = this.carBranId.brandId;
			
		},
		onShow() {
			this.getSeriesList();
		},
		data() {
			return {
				brandId:"",
				scrollTop: 0,
				list: [],
				carBranId:{}
			}
		},
		methods:{
			getSeriesList(){
				let data = {
					brandId:this.brandId
				}
				API.getSeriesList(data).then(res=>{
					console.log(res);
					this.list = res.data;
				})
			},
			
			carSeriesClick(item){
				
				var listdel = app.globalData.dxcx;
				if(app.globalData.xzType){
					if(listdel.length==0){
						item.cishu = 1;
						listdel.push(item)
					}else{
						var index = listdel.map(del=>del.seriesId).indexOf(item.seriesId)
						if(index !=-1){
							listdel[index].cishu+=1
						}else{
							item.cishu = 1;
							listdel.push(item)
						}
					}
					app.globalData.dxcx = listdel;
				}else{
					app.globalData.dgxzcx = item
				}
				
				uni.navigateBack({
					delta: 2
				})
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		}
	},
	}
</script>

<style lang="scss" scoped>
	.list-cell {
		display: flex;
		box-sizing: border-box;
		width: 100%;
		padding: 10px 24rpx;
		overflow: hidden;
		color: $u-content-color;
		font-size: 14px;
		line-height: 24px;
		background-color: #fff;
	}
	.bxpp{
		background: #bec5d1;
		border-top:1px solid #8694aa;
		border-bottom:1px solid #8694aa;
		line-height: 80rpx;
		padding: 0 24rpx;
		box-sizing: border-box;
	}
	.bxpp_letter{
		padding: 0 24rpx;
		box-sizing: border-box;
		line-height: 60rpx;
	}
</style>
